﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace AbpEntityFrameworkcore.Migrations
{
    /// <inheritdoc />
    public partial class _2024572141 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "Batch",
                table: "MaterialBase");

            migrationBuilder.DropColumn(
                name: "Description",
                table: "MaterialBase");

            migrationBuilder.DropColumn(
                name: "Info",
                table: "MaterialBase");

            migrationBuilder.DropColumn(
                name: "Size",
                table: "MaterialBase");

            migrationBuilder.DropColumn(
                name: "Type",
                table: "MaterialBase");

            migrationBuilder.DropColumn(
                name: "Unit",
                table: "MaterialBase");

            migrationBuilder.AddColumn<Guid>(
                name: "MaterialPropertyMaterialProertyid",
                table: "MaterialBase",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.CreateTable(
                name: "MaterialProperty",
                columns: table => new
                {
                    MaterialProertyid = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    MaterialProertyname = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "属性名称"),
                    Unit = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "单位"),
                    Type = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "类型"),
                    Description = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "说明"),
                    Batch = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "批次号"),
                    Size = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "物料大小"),
                    Info = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Info2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Info3 = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Info4 = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MaterialProperty", x => x.MaterialProertyid);
                });

            migrationBuilder.CreateIndex(
                name: "IX_MaterialBase_MaterialPropertyMaterialProertyid",
                table: "MaterialBase",
                column: "MaterialPropertyMaterialProertyid");

            migrationBuilder.AddForeignKey(
                name: "FK_MaterialBase_MaterialProperty_MaterialPropertyMaterialProertyid",
                table: "MaterialBase",
                column: "MaterialPropertyMaterialProertyid",
                principalTable: "MaterialProperty",
                principalColumn: "MaterialProertyid");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_MaterialBase_MaterialProperty_MaterialPropertyMaterialProertyid",
                table: "MaterialBase");

            migrationBuilder.DropTable(
                name: "MaterialProperty");

            migrationBuilder.DropIndex(
                name: "IX_MaterialBase_MaterialPropertyMaterialProertyid",
                table: "MaterialBase");

            migrationBuilder.DropColumn(
                name: "MaterialPropertyMaterialProertyid",
                table: "MaterialBase");

            migrationBuilder.AddColumn<string>(
                name: "Batch",
                table: "MaterialBase",
                type: "nvarchar(max)",
                nullable: true,
                comment: "批次号");

            migrationBuilder.AddColumn<string>(
                name: "Description",
                table: "MaterialBase",
                type: "nvarchar(max)",
                nullable: true,
                comment: "说明");

            migrationBuilder.AddColumn<string>(
                name: "Info",
                table: "MaterialBase",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Size",
                table: "MaterialBase",
                type: "nvarchar(max)",
                nullable: true,
                comment: "物料大小");

            migrationBuilder.AddColumn<string>(
                name: "Type",
                table: "MaterialBase",
                type: "nvarchar(max)",
                nullable: true,
                comment: "类型");

            migrationBuilder.AddColumn<string>(
                name: "Unit",
                table: "MaterialBase",
                type: "nvarchar(max)",
                nullable: true,
                comment: "单位");
        }
    }
}
